package Middleware

import (
	"github.com/gin-gonic/gin"
)

func AdminAuth() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		token := ctx.Query("token")
		if token == "" {
			ctx.JSON(200, gin.H{
				"code": 400,
				"msg":  "用户未登录",
			})
			// 终止
			ctx.Abort()
		} else {
			ctx.Next()
		}
	}
}
